package com.ctgu.edu.service.impl;

import com.ctgu.edu.dao.JobMapper;
import com.ctgu.edu.pojo.Job;
import com.ctgu.edu.pojo.Resume;
import com.ctgu.edu.service.JobService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.LinkedList;
import java.util.Map;

@Service
public class JobServiceImpl implements JobService {

    @Autowired
    @Qualifier("jobMapper")
    private JobMapper jobMapper;

    public void setJobMapper(JobMapper jobMapper) {
        this.jobMapper = jobMapper;
    }

    public void addJob(Job job) {
        jobMapper.addJob(job);
    }

    public void deleteJobById(Integer jobId) {
        jobMapper.deleteJobById(jobId);
    }

    public void updateJob(Job job) {
        jobMapper.updateJob(job);
    }

    public Job getJobById(Integer jobId) {
        return jobMapper.getJobById(jobId);
    }

    //传入startIndex和pageSize，实现分页查找
    public LinkedList<Job> getJobByClickTimes(Integer startIndex,Integer pageSize) {
        Map<String,Integer> map = new HashMap<String,Integer>();
        map.put("startIndex",startIndex);
        map.put("pageSize",pageSize);
        return jobMapper.getJobByClickTimes(map);
    }

    public LinkedList<Job> getJobByRecId(Integer recId) {
        return jobMapper.getJobByRecId(recId);
    }

    public LinkedList<Job> getJobLike(String jobKey) {
        jobKey = "%"+jobKey+"%";
        return jobMapper.getJobLike(jobKey);
    }

    public Integer getJobNum(){
        return jobMapper.getJobNum();
    }
}
